define(
		[ "PDAppDir/properties", "PDUtilDir/util", "PDUtilDir/tool", "PDUtilDir/slidebar",
				"PDUtilDir/inputSelect" ],
		function(Properties, Util, Tool, Slidebar, inputSelect, MFU) {
			function refundSupportInit($scope, $compile) {
				return new refundSupport($scope, $compile);
			}
			function refundSupport($scope, $compile) {
				this.$scope = $scope;
				this.$compile = $compile;
			}
			refundSupport.fn = refundSupport.prototype;
			refundSupport.fn.digest = function() {
				this.$scope.$digest();
			};
			refundSupport.fn.init = function(id) {
				var _this = this;
                this.entity = {
                    orderNo: id,
                    rebackRecoder: {}
                };
                // this.cache = {
                //     fileServer: Properties.URL_FILE_SERVER_URL,
                //     images: new Array()
                // }
                // $.ajax({
                //     url : getServer() + "/flea/hclv/qr/manage/selectByDeptId.htmls",
                //     success : function(data) {
                //         if(data.status == 200){
                //             _this.cache.images = data.data;
                //             _this.digest();
                //         }
                //     }
                // });
			};
			refundSupport.fn.run = function(id) {
				var _this = this;
				_this.init(id);
				this.slidebars = Slidebar({
					size : 'lg',
					url : getServer() + "/static/app/order/orderInfos/views/refund.html",
//					close : true,
					$scope : this.$scope,
					$compile : this.$compile,
					afterLoad : function($Panel) {
						_this.initialization();
					}
				});
			};
			refundSupport.fn.initialization = function() {
				var _this = this;
                // 初始化支付类型下拉框
                inputSelect.dropCache();
                inputSelect({
                    id : "platformTypeName",
                    key : {
                        id : "dictCode",
                        name : "dictName",
                        data : "data",
                    },
                    data : _this.$scope.cache.types,
                    simpleData : true,
                    searchAble : false,
                    callback : function(id, obj) {
                        _this.entity.rebackRecoder.platformType = id[0];
                        _this.$scope.refundFormId.platformType.$setViewValue(_this.entity.rebackRecoder.platformType);
                    }
                });
			};
            refundSupport.fn.save = function() {
                var _this = this;
                $.ajax({
                    url : getServer() + "/flea/hclv/visitor/visitorPay/addRebackRecoder.htmls",
                    data : {
                        'model' : JSON.stringify(_this.entity)
                    },
                    success : function(data) {
                        if (data.status != 200) {
                            return;
                        }
                        _this.$scope.grid.refresh();
                        Util.alert(data.message);
                        _this.slidebars.close();
                    }
                });
            };
			return refundSupportInit;
		});